<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Yelp Restaurant Data Scraper</title>
    <link rel="stylesheet" href="popup.css" />
    <style>
      .title-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        border-bottom: 1px solid #ddd;
        padding-bottom: 10px;
      }
      .close-btn {
        background: none;
        border: none;
        font-size: 20px;
        cursor: pointer;
        color: #666;
      }
      .close-btn:hover {
        color: #f00;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="title-bar">
        <h1>Yelp Restaurant Data Scraper</h1>
        <button id="closeWindow" class="close-btn" title="关闭窗口">×</button>
      </div>

      <div class="form-group">
        <label for="location">Location (City, State):</label>
        <input
          type="text"
          id="location"
          placeholder="Leave empty to search all US"
        />
        <small class="hint">Leave empty to search all United States</small>
      </div>

      <div class="form-group">
        <label for="category">Restaurant Type:</label>
        <input
          type="text"
          id="category"
          placeholder="e.g. Chinese, Italian, Mexican"
        />
        <small class="hint">Leave empty for no restaurant type filter</small>
      </div>

      <div class="form-group">
        <label for="keyword">Keywords:</label>
        <input
          type="text"
          id="keyword"
          placeholder="e.g. Breakfast, Seafood, Vegan"
        />
      </div>

      <div class="form-group">
        <label for="pages">Pages to Scrape:</label>
        <input type="number" id="pages" min="1" max="20" value="5" />
      </div>

      <div class="form-group checkbox-group">
        <input type="checkbox" id="sortByReviews" checked />
        <label for="sortByReviews">按评论数量从高到低排序</label>
        <small class="hint">Sort restaurants by most reviewed first</small>
      </div>

      <div class="form-group">
        <label for="delay">Page Load Delay (seconds):</label>
        <input type="number" id="delay" min="1" max="10" value="2" />
        <small class="hint"
          >Increase delay for better scraping success rate</small
        >
      </div>

      <div class="buttons">
        <button id="startScrape">Start Scraping</button>
        <button id="pauseResume" disabled>Pause</button>
        <button id="exportData" disabled>Export Data</button>
      </div>

      <div class="status">
        <p id="statusText">Ready</p>
        <div id="progressBar">
          <div id="progressFill"></div>
        </div>
        <p id="dataCount" class="data-count">Collected data: 0 restaurants</p>
      </div>
    </div>
    <script src="popup.js"></script>
  </body>
</html>
